#ifndef ORDERROLEBASE_H
#define ORDERROLEBASE_H

#include"saleBase.h"
#include"../dao/daobase.h"
#include<vector>
using std::vector;


//订单作用基类
class OrderRoleBase:public DaoBase
{
public:
    OrderRoleBase(){type=CLASS_ORDERROLEBASE;}

    /*
     * 作用在多个售卖的食物上，返回优惠后的价格，details存储优惠描述信息
     * */
    virtual double priceAdjustment(vector<SaleBase*> sales,double curPrice)
    {
        Q_UNUSED(sales);
        return curPrice;
    }

    int getClassType(){return type;}

    virtual string toString()
    {
        return description/*+"\t"+QString::number(value).toStdString()+"  \n***\n"*/;
    }

    virtual void selectOne(){};

    virtual void del(){};

    virtual void insert(){};


public:
    int id;

    string description;//优惠描述

    double value;//作用值

    vector<int> scope;//该优惠作用于哪些食物id上

    int type;//优惠类型，有几种固定的取值

    const static int CLASS_ORDERROLEBASE=-1;
    const static int CLASS_MULORDERROLE=0;
    const static int CLASS_SUBORDERROLE=1;


};

#endif // ORDERROLEBASE_H
